export class FResponse {
  data: any
  code: number
  success: boolean
  message: string
  constructor(data: any, code: number, success: boolean, message: string) {
    this.data = data
    this.code = code
    this.success = success
    this.message = message
  }

  static success(data: any, message: string = 'success') {
    return new FResponse(data, 200, true, message)
  }

  static error(data: any, message: string = 'error') {
    return new FResponse(data, 500, false, message)
  }

  static fail(data: any, message: string = 'fail') {
    return new FResponse(data, 400, false, message)
  }

  static notFound(data: any, message: string = 'not found') {
    return new FResponse(data, 404, false, message)
  }

  static unauthorized(data: any, message: string = 'unauthorized') {
    return new FResponse(data, 401, false, message)
  }

  static forbidden(data: any, message: string = 'forbidden') {
    return new FResponse(data, 403, false, message)
  }
}
